﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    xmlns:conv="clr-namespace:QuickZip.Converters"       >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Colors.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Buttons.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="SimpleExpander" TargetType="{x:Type Expander}">
        <DockPanel>
            <ToggleButton x:Name="ExpanderButton"
                      DockPanel.Dock="Top"
                      Template="{StaticResource ExpanderArrowButton}"
                      Content="{TemplateBinding Header}"
                      IsChecked="{Binding Path=IsExpanded, 
                      RelativeSource={RelativeSource TemplatedParent}}"
                      OverridesDefaultStyle="True"
                      Padding="1.5,0">
            </ToggleButton>
            <ContentPresenter x:Name="ExpanderContent"
                          Visibility="Collapsed"
                          DockPanel.Dock="Bottom"/>
        </DockPanel>
        <ControlTemplate.Triggers>
            <Trigger SourceName="ExpanderButton" Property="Content" Value="{x:Null}">
                <Setter TargetName="ExpanderButton" Property="Visibility" Value="Collapsed" />
                <Setter TargetName="ExpanderContent" Property="Visibility" Value="Visible"/>
            </Trigger>

            <Trigger Property="IsExpanded" Value="True">
                <Setter TargetName="ExpanderContent" Property="Visibility" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <Style x:Key="SimpleGroupItemTemplate" TargetType="{x:Type GroupItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Expander IsExpanded="True" 
                                                  x:Name="expander"
                                                  Template="{StaticResource SimpleExpander}">
                        <Expander.Header>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Name}" />
                                <!--<TextBlock Text=" (" />
                                                    <TextBlock Text="{Binding ItemCount}" />
                                                    <TextBlock Text=") items" />-->
                            </StackPanel>
                        </Expander.Header>
                        <ItemsPresenter />
                    </Expander>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Name}" Value="">
                            <Setter TargetName="expander" Property="Header" Value="{x:Null}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>